package com.zjitc.obj;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/3/5 15:02
 * @description:
 */
public class User {
private String name;
private Integer age;
private String home;
  public User(){
    this("body",10);
  }

  public User(String name, Integer age, String home) {
    this.name = name;
    this.age = age;
    this.home = home;
  }

  public User(String name, Integer age) {
    this.name = name;
    this.age = age;
  }

  public void init(){
    System.out.println("init");
  }
  public Integer getAge() {
    return age;
  }

  public void setAge(Integer age) {
    this.age = age;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }
  public void close(){
    System.out.println("close");
  }

  public String getHome() {
    return home;
  }

  public void setHome(String home) {
    this.home = home;
  }

  @Override
  public String toString() {
    return "User{" +
        "name='" + name + '\'' +
        ", age=" + age +
        ", home='" + (home ==null ?"":home)+ '\'' +
        '}';
  }
public static User createInstance(Integer age){
    if (age>100){
      return new User("bigger than 100",age);
    }else {
      return new User("smaller than 100",age);
    }
}

}
